﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="UserAddressCommon.aspx.cs"
    Inherits="Home_AS_UserAddressCommon" %>

<%@ Import Namespace="Shopping.BLL" %>
<%@ Import Namespace="Shopping.Model" %>
<%@ Import Namespace="Shopping.Common" %>
<script type="text/javascript" src="/home/js/useraddresscommon.js"></script>
<script type="text/javascript">
var commonaddressid=<%=_useradd==null?0:_useradd.UserAddressID %>;
</script>
<style type="text/css">
    .orderstable
    {
        border-left: 1px solid #CCCCCC;
        border-top: 1px solid #CCCCCC;
    }
    .orderTr
    {
        height: 25px;
    }
    .orderTdOne
    {
        background: none repeat scroll 0 0 #F2F2F2;
        border-bottom: 1px solid #CCCCCC;
        border-right: 1px solid #CCCCCC;
        color: #444444;
        font-size: 13px;
        font-weight: bold;
        text-align: center;
    }
    .orderTdTwo
    {
        border-bottom: 1px solid #CCCCCC;
        border-right: 1px solid #CCCCCC;
        color: #444444;
        font-size: 13px;
        line-height: 24px;
        text-align: center;
    }
    .saveinfo
    {
        background: url('/images/save_button_orderinfo.gif');
        width: 80px;
        height: 23px;
        display: block;
        line-height: 20px;
        color: White;
        font-weight: bold;
        text-decoration: none;
    }
</style>
<%if (!string.IsNullOrEmpty(tag))
  { %>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="orderstable commontab">
    <tr class="orderTr">
        <td align="right" class="orderTdTwo" style="text-align: right;" colspan="7">
            <a href="javascript:void(0);" id="commonAddress" onclick="ReSetUserAddress()">新增收货地址</a>
        </td>
    </tr>
    <tr class="orderTr">
        <td height="25" align="center" class="orderTdOne">
            收货人
        </td>
        <td height="25" align="center" class="orderTdOne">
            收货地址
        </td>
        <td height="25" align="center" class="orderTdOne">
            邮编
        </td>
        <td height="25" align="center" class="orderTdOne">
            手机
        </td>
        <td height="25" align="center" class="orderTdOne">
            电话
        </td>
        <td height="25" align="center" class="orderTdOne">
            是否默认
        </td>
        <td height="25" align="center" class="orderTdOne">
            操作
        </td>
    </tr>
    <%if (_userAddress != null && _userAddress.Count > 0)
      {
          for (var i = 0; i < _userAddress.Count; i++)
          { 
              
    %>
    <tr id="tr<%=_userAddress[i].UserAddressID %>" class="orderTr" tag='<%=JSONHelper.ObjectToJson(_userAddress[i]) %>'>
        <td height="25" align="center" class="orderTdTwo">
            <%=_userAddress[i].ReceiverName%>
        </td>
        <td height="25" align="center" class="orderTdTwo">
            <%=_userAddress[i].ReceiverAddress%>
        </td>
        <td height="25" align="center" class="orderTdTwo">
            <%=_userAddress[i].ReceiverZipCode%>
        </td>
        <td height="25" align="center" class="orderTdTwo">
            <%=_userAddress[i].ReceiverMobile%>
        </td>
        <td height="25" align="center" class="orderTdTwo">
            <%=_userAddress[i].ReceiverPhone%>
        </td>
        <td height="25" align="center" class="orderTdTwo">
            <%=_userAddress[i].IsDefault ? "<font color='green'>是</font>" : "否"%>
        </td>
        <td height="25" align="center" class="orderTdTwo">
            【<a href="javascript:void(0);" name="addressSelect">选择</a>】 【<a href="javascript:void(0);"
                name="updateAddress">修改</a>】
        </td>
    </tr>
    <%}
      }
      else
      {%>
    <tr class="orderTr">
        <td colspan="7" class="orderTdTwo">
            [ 您还没有设置任何收货地址！]
        </td>
    </tr>
    <%} %>
</table>
<br />
<br />
<%} %>
<table width="90%" id="useraddresstable" border="0" cellpadding="0" cellspacing="0"
    bgcolor="#e2e2e2">
    <tr>
        <td height="25" align="center" bgcolor="#FFFFFF">
            收货人*
        </td>
        <td bgcolor="#FFFFFF">
            <input type="text" id="txtReciveName" value="<%=_useradd==null?"":_useradd.ReceiverName %>" />
        </td>
    </tr>
    <tr>
        <td height="25" align="center" bgcolor="#FFFFFF">
            地区*
        </td>
        <td bgcolor="#FFFFFF">
            <select id="province" style="width: 110px;">
                <%if (provinceList != null && provinceList.Count > 0)
                  {
                      for (var i = 0; i < provinceList.Count; i++)
                      { %>
                <option value="<%=provinceList[i].ProvinceID %>">
                    <%=provinceList[i].ProvinceName %></option>
                <%}
                  } %>
            </select><select id="city" style="min-width: 100px;">
                <%
                    if (_citylist != null)
                        for (var i = 0; i < _citylist.Count; i++)
                        { %>
                <option value="<%=_citylist[i].ID %>" <%=_citylist[i].ID==_currentUserAddress.CityID?"selected=selected":"" %>>
                    <%=_citylist[i].Name %></option>
                <%} %>
            </select>
            <select id="area" style="min-width: 100px;">
                <%
                    if (_arealist != null)
                        for (var i = 0; i < _arealist.Count; i++)
                        { %>
                <option value="<%=_arealist[i].ID %>" <%=_arealist[i].ID==_currentUserAddress.AreaID?"selected=selected":"" %>>
                    <%=_arealist[i].Name%></option>
                <%} %>
            </select>
        </td>
    </tr>
    <tr>
        <td height="25" align="center" bgcolor="#FFFFFF">
            收货地址*
        </td>
        <td bgcolor="#FFFFFF">
            <input type="text" id="txtReciveAddress" value="<%=_useradd==null?"":_useradd.ReceiverAddress %>" />
        </td>
    </tr>
    <tr>
        <td height="25" align="center" bgcolor="#FFFFFF">
            邮编*
        </td>
        <td bgcolor="#FFFFFF">
            <input type="text" id="txtReciveZip" value="<%=_useradd==null?"":_useradd.ReceiverZipCode %>" />
        </td>
    </tr>
    <tr>
        <td height="25" align="center" bgcolor="#FFFFFF">
            手机
        </td>
        <td bgcolor="#FFFFFF">
            <input type="text" id="txtReciveMobile" value="<%=_useradd==null?"":_useradd.ReceiverMobile %>" />
        </td>
    </tr>
    <tr>
        <td height="25" align="center" bgcolor="#FFFFFF">
            电话
        </td>
        <td bgcolor="#FFFFFF">
            <input type="text" id="txtRecivephone" value="<%=_useradd==null?"":_useradd.ReceiverPhone %>" />
        </td>
    </tr>
    <tr>
        <td height="25" align="center" bgcolor="#FFFFFF">
            是否默认
        </td>
        <td bgcolor="#FFFFFF">
            <input type="checkbox" id="isdefault" <%=_useradd!=null &&_useradd.IsDefault?"checked=true":"" %> />
        </td>
    </tr>
    <tr>
        <td colspan="2" align="center" bgcolor="#FFFFFF">
            <img src="/images/submit_button.gif" id="ubtnSubmit1" style="display: none;" />
            <a href="javascript:void(0);" id="ubtnSubmit" class="saveinfo">保存</a>
        </td>
    </tr>
</table>
